<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/3/25
 * Time: 16:21
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\common\model;

class WeixinUser extends Base
{
    public function getTypeList()
    {
        return ['0' => '小程序', '1' => '微信公众号',];
    }

    public function getStatusList()
    {
        return ['0' => '禁用', '1' => '启用',];
    }

    /**
     * @param string $openid
     * @param string $field
     * @return WeixinUser|array|mixed|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getWeixinUserByOpenid(string $openid = '', string $field = '*')
    {
        return $this->field($field)
            ->where('openid', $openid)
            ->find();
    }
}